package com.bigmi.article.controller;

import com.bigmi.article.service.ArticleService;
import com.bigmi.common.cont.ArticleCont;
import com.bigmi.model.article.Dto.ArticleHomeDto;
import com.bigmi.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/api/v1/article")
public class ArticleHomeController {
    @Autowired private ArticleService articleService;

    //加载首页
    @PostMapping("/load")
    public ResponseResult load(@RequestBody ArticleHomeDto articleHomeDto){
        return  articleService.articleList(articleHomeDto, ArticleCont.LOADTYPE_LOAD_MORE);

    }
    //加载更多
    @PostMapping("/loadnew")
    public ResponseResult loadnew(@RequestBody ArticleHomeDto articleHomeDto){
        return  articleService.articleList(articleHomeDto, ArticleCont.LOADTYPE_LOAD_MORE);
    }
    //加载最新
    @PostMapping("/loadmore")
    public ResponseResult loadmore(@RequestBody ArticleHomeDto articleHomeDto){
        return  articleService.articleList(articleHomeDto, ArticleCont.LOADTYPE_LOAD_NEW);
    }
}
